package juc.sync;

import lombok.extern.slf4j.Slf4j;
import org.openjdk.jol.info.ClassLayout;

/**
 * 无锁 001
 * 偏向锁 101
 * 轻量级锁00
 * 重量级锁10
 */
@Slf4j
public class LockEscalationDemo {

    public static void main(String[] args) throws InterruptedException {

        log.debug(ClassLayout.parseInstance(new Object()).toPrintable());
        //HotSpot 虚拟机在启动后有个4s的延迟才会对每个新建的对象开始偏向锁模式
        Thread.sleep(5000);
        Object obj = new Object();
        obj.wait();
        log.debug(ClassLayout.parseInstance(obj).toPrintable());

    }

}


